<!--{template header,admin}-->
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/dialog.js" type="text/javascript"></script>
<script src="js/admin.js" type="text/javascript"></script>
<script src="js/calendar.js" type="text/javascript"></script>
<div id="append">
</div>
<div style="width:100%; height:15px;color:#000;margin:0px 0px 10px;">
  <div style="float:left;"><a href="index.php?admin_main/stat{$setting['seo_suffix']}" target="main"><b>控制面板首页</b></a>&nbsp;&raquo;&nbsp;回答管理</div>
</div>
<!--{if isset($message)}-->
<!--{eval $type=isset($type)?$type:'correctmsg'; }-->
<table cellspacing="1" cellpadding="4" width="100%" align="center" class="tableborder">
	<tr>
		<td class="{$type}">{$message}</td>
	</tr>
</table>
<!--{/if}-->
<form action="index.php?admin_question/searchanswer{$setting['seo_suffix']}" method="post">
<table width="100%" cellspacing="1" cellpadding="4" align="center" class="tableborder">
	<tbody>
	<tr class="header" ><td colspan="4">回答搜索</td></tr>
	<tr class="altbg1"><td colspan="4">可以通过如下搜索条件，检索问题回答</td></tr>
	<tr>
        <td width="200"  class="altbg2">标题:<input type="text" name="srchtitle" /></td>
        <td  width="200" class="altbg2">回答者:<input type="text" name="srchauthor" /></td>
        <td  width="250" class="altbg2">关键字:	<input type="text" name="keywords" size="30" maxlength="50"/></td>
        <td rowspan="2" class="altbg2"><input class="btn" type="submit" value="提 交"></td>
   </tr>
   <tr>
   	<td colspan="4" class="altbg2">回答时间<input type="text" onclick="showcalendar();" name="srchdatestart" />到&nbsp;<input class="txt" onclick="showcalendar();" name="srchdateend" /></td>
   </tr>
	</tbody>
</table>
</form>
[共 <font color="green">{$rownum}</font> 条回答]
<form name="answerlist" method="post">
 <table width="100%" border="0" cellpadding="4" cellspacing="1" class="tableborder">
	<tr class="header">
		<td width="10%"><input class="checkbox" id="chkall" onclick="checkall('aid[]')" type="checkbox" name="chkall"><label for="chkall">全选</label></td>
		<td  width="40%">回答内容</td>
		<td  width="10%">回答人</td>
		<td  width="20%">回答时间</td>
		<td  width="10%">是否被采纳</td>
		<td  width="10%">已审核</td>
	</tr>
	<!--{if isset($answerlist)} {loop $answerlist $answer}-->
	<tr>
		<!--{eval $content=htmlspecialchars($answer['content']);}-->
		<td class="altbg2"><input type="hidden" id="cont_{$answer['id']}" value="{$content}"/><input class="checkbox" type="checkbox" value="{$answer['id']}" name="aid[]"></td>
		<td class="altbg2" id="title_{$answer['id']}">{$answer['content']}[<a href="index.php?question/view/{$answer['qid']}{$setting['seo_suffix']}" style="color:#2366A8" target="_blank">查看问题</a>]</td>
		<td class="altbg2"><a href="index.php?user/space/{$answer['authorid']}{$setting['seo_suffix']}" target="_blank">{$answer['author']}</a></td>
		<td class="altbg2">{$answer['time']}</td>
		<td class="altbg2">{if $answer['adopttime']}<img title="已被采纳为最佳答案" src="{SITE_URL}css/common/icn_2.gif">{else}否{/if}</td>
		<td class="altbg2">{if $answer['status']}<font color="Red">是</font>{else}否{/if}</td>
	</tr>
	<!--{/loop} {/if}-->
	<!--{if $departstr}-->
	<tr class="smalltxt">
		<td class="altbg2" colspan="6">{$departstr}</td>
	</tr>
	<!--{/if}-->
	<tr>
		<td colspan="6" class="altbg1"><input class="btn" type="button" value="审核" onclick="verifyansw()"/>&nbsp;&nbsp;&nbsp;<input class="btn" type="button" value="修改内容" onclick="editcont()"/>&nbsp;&nbsp;&nbsp;<input class="btn" type="button" name="delete" value="删除" onclick="deleteanswer();" /></td>
	</tr>
</table>
</form>
<!--{template footer,admin}-->
<script charset="utf-8" src="js/editor/kindeditor.js"></script>
<script type="text/javascript">
function editcont(){
		if ($("input[name='aid[]']:checked").length > 1){
			alert('只能同时对一个回答进行操作！');
			return false;
		}else if($("input[name='aid[]']:checked").length == 0){
			alert('你没有选择任何回答');
			return false;
		}else{
			var aid = $("input[name='aid[]']:checked").val();
			var content = $('#cont_'+aid).val();
			var title = $('#title_'+aid).text();
			$.dialog({
			    id:'editanswerDiv',
			    position:'center',
			    align:'left',
			    fixed:1,
			    width:600,
			    title:'修改问题内容',
			    fnOk:function(){document.editanswerForm.submit();$.dialog.close('editanswerDiv')},
			    fnCancel:function(){$.dialog.close('editanswerDiv')},
			    content:'<div>问题标题：'+title+'<br /><form name="editanswerForm"  action="index.php?admin_question/editanswercont{$setting['seo_suffix']}" method="post" ><textarea id="mc" name="content" style="width: 95%; padding-top: 1px; font-size: 14px;" rows="10" >'+content+'</textarea><input type="hidden"  value="'+aid+'" name="aid"/></form></div>'
			  });
			KE.init({
				id : 'mc',
				resizeMode : 1,
				allowUpload : false,
				newlineTag : 'br',
				items : [
				'fontname', 'fontsize', '|', 'textcolor', 'bgcolor', 'bold', 'italic', 'underline',
				'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
				'insertunorderedlist', '|', 'image', 'link']
			});
			KE.create('mc');
		}
}
function deleteanswer(){
	if($("input[name='aid[]']:checked").length == 0){
		alert('你没有选择任何回答');
		return false;
	}
	if(confirm('确定删除回答?')==false){
		return false;
	}
	document.answerlist.action="index.php?admin_question/deleteanswer{$setting['seo_suffix']}";
	document.answerlist.submit();
}

function verifyansw(){
	if($("input[name='aid[]']:checked").length == 0){
		alert('你没有选择任何回答');
		return false;
	}
	document.answerlist.action="index.php?admin_question/verifyanswer{$setting['seo_suffix']}";
	document.answerlist.submit();		
}
</script>


